/*
 * @Description: 浪潮导出机票订单
 * @Version: 2.0
 * @Autor: 许国辉
 * @Date: 2023-05-19 08:24:06
 * @LastEditors: 许国辉
 * @LastEditTime: 2024-12-13 08:28:43
 */
import { BasicColumn } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import dayjs from 'dayjs';
export const comprehensiveAirColumns: BasicColumn[] = [
  //1
  {
    title: '终端类型',
    dataIndex: 'zdlx',
    width: 100,
    customRender: ({ record }) => {
      if (record.cid === '70001') {
        return h(Tag, { color: 'green' }, () => 'PC');
      } else {
        return h(Tag, { color: 'green' }, () => 'APP');
      }
    },
  },
  //2
  {
    title: '出票日期',
    dataIndex: 'outTicketDate',
    width: 160,
    customRender: ({ record }) => {
      if (record.outTicketDate) return dayjs(record.outTicketDate).format('YYYY/MM/DD HH:mm:ss');
    },
  },
  { title: '预定人姓名', dataIndex: 'bookerName', width: 100 },
  { title: '预定人手机', dataIndex: 'bookerTel', width: 130 },
  { title: '审批单号', dataIndex: 'exNum', width: 150 },
  {
    title: '审批出发日期',
    dataIndex: 'a1',
    width: 140,
    customRender: ({ record }) => {
      if (record.dateOfDeparture) return dayjs(record.dateOfDeparture).format('YYYY/MM/DD');
    },
  },
  {
    title: '审批返回日期',
    dataIndex: 'a2',
    width: 140,
    customRender: ({ record }) => {
      if (record.dateOfReturn) return dayjs(record.dateOfReturn).format('YYYY/MM/DD');
    },
  },
  { title: '员工编号', dataIndex: 'empNo', width: 80 },
  { title: 'PNR', dataIndex: 'pnr', width: 80 },
  { title: '全价', dataIndex: 'cabinAllPrice', width: 90 },
  { title: '票号', dataIndex: 'tickerNo', width: 140 },
  { title: '员工姓名', dataIndex: 'empName', width: 90 },
  { title: '联系手机', dataIndex: 'empTel', width: 130 },
  { title: '行程', dataIndex: 'voyage', width: 150 },
  { title: '航班号', dataIndex: 'flightNum', width: 80 },
  {
    title: '航空公司',
    dataIndex: 'carrierName',
    key: 'carrierName',
    customRender: ({ record }) => {
      return record.carrierName ? record.carrierName + '(' + record.carrierCode + ')' : '-';
    },
  },
  {
    title: '出发日期',
    dataIndex: 'deptDate',
    width: 130,
    customRender: ({ record }) => {
      return record.deptDate ? dayjs(record.deptDate).format('YYYY/MM/DD') : '-';
    },
  },
  { title: '出发时间', dataIndex: 'deptTime', width: 80 },
  {
    title: '抵达日期',
    dataIndex: 'arriveDate',
    width: 130,
    customRender: ({ record }) => {
      return record.arriveDate ? dayjs(record.arriveDate).format('YYYY/MM/DD') : '-';
    },
  },
  { title: '抵达时间', dataIndex: 'arriveTime', width: 80 },
  { title: '舱位', dataIndex: 'cabinCode', key: 'cabinCode', width: 80 },
  { title: '机票价', dataIndex: 'salePrice', key: 'salePrice', width: 90 },
  { title: '税', dataIndex: 'taxSum', key: 'taxSum', width: 90 },
  { title: '机票合计金额', dataIndex: 'planePriceSum', key: 'planePriceSum', width: 110 },
  {
    title: '改签费',
    width: 90,
    dataIndex: 'changeFreeSum',
    customRender: ({ record }) => {
      return record.changeFee + record.changeUpFee;
    },
  },
  { title: '应退款(含税)', dataIndex: 'refundBeAmount', width: 110 },
  { title: '保险', dataIndex: 'insurance', key: 'insurance', width: 90 },
  {
    title: '用车',
    dataIndex: 'a3',
    width: 90,
    customRender: () => {
      return 0;
    },
  },
  {
    title: '其它',
    dataIndex: 'a4',
    width: 90,
    customRender: () => {
      return 0;
    },
  },
  { title: '折扣率', dataIndex: 'agio', key: 'agio', width: 90 },
  { title: '服务费', dataIndex: 'ticketServicePrice', key: 'ticketServicePrice, width: 90 ' },
  {
    title: '深白云扣款',
    dataIndex: 'priceBy',
    key: 'priceBy',
    width: 105,
    customRender: ({ record }) => {
      if (record.bookingType == '改期单') return record.changeUpFee + record.changeFee;
      else if (record.bookingType == '退票单')
        return (
          record.refundPrice +
          record.ticketPrice -
          record.insurance +
          (record.changeUpFee + record.changeFee)
        );
      else return record.ticketPrice + record.insurance;
    },
  },
  { title: '退票费(财务)', dataIndex: 'refundPrice', width: 105 },
  {
    title: '应收',
    dataIndex: 'ticketPrice',
    key: 'ticketPrice',
    width: 90,
    customRender: ({ record }) => {
      if (record.bookingType == '改期单') return record.changeUpFee + record.changeFee;
      else if (record.bookingType == '退票单')
        return (
          record.refundPrice +
          record.ticketPrice -
          record.insurance +
          (record.changeUpFee + record.changeFee)
        );
      else return record.ticketPrice + record.insurance;
    },
  },
  {
    title: '总金额包含服务费',
    dataIndex: 'ticketPriceSum',
    key: ' ticketPriceSum',
    width: 130,
    customRender: ({ record }) => {
      if (record.bookingType == '改期单')
        return record.changeUpFee + record.changeFee + record.ticketServicePrice;
      else if (record.bookingType == '退票单')
        return (
          record.refundPrice +
          record.ticketPriceSum +
          record.changeUpFee +
          record.changeFee +
          record.insurance
        );
      else return record.ticketPriceSum + record.insurance;
    },
  },
  {
    title: '订票方式',
    dataIndex: 'a5',
    customRender: () => {
      return '有审批单';
    },
  },
  {
    title: '结算',
    dataIndex: 'a6',
    customRender: ({}) => {
      return '-';
    },
  },
  {
    title: '白云对帐',
    dataIndex: 'a7',
    customRender: ({}) => {
      return '-';
    },
  },
  {
    title: '支付时间',
    dataIndex: 'a8',
    customRender: ({ record }) => {
      return record.payDate ? dayjs(record.payDate).format('YYYY/MM/DD') : '-';
    },
  },
  {
    title: '订票类型',
    dataIndex: 'bookingType',
    customRender: ({ record }) => {
      return record.bookingType;
    },
  },
  {
    title: '机票类型',
    dataIndex: 'a10',
    customRender: ({ record }) => {
      return record.belongType;
    },
  },
  {
    title: '备注',
    dataIndex: 'remark',
    customRender: ({ record }) => {
      return record.remark ? record.remark : '-';
    },
  },
  { title: '身份证号', dataIndex: 'empIdNum', width: 180 },
  {
    title: '消费记录id',
    dataIndex: 'a12',
    customRender: ({ record }) => {
      return 'flight' + record.id;
    },
  },
  // {
  //   title: '订单号',
  //   dataIndex: 'a13',
  //   width: 190,
  //   customRender: ({ record }) => {
  //     return record.orderNum;
  //   },
  // },
  {
    title: '乘机人卡号',
    dataIndex: 'a14',
    width: 160,
    customRender: ({ record }) => {
      return record.empIdNum;
    },
  },
  {
    title: '出发城市',
    dataIndex: 'a15',
    customRender: ({ record }) => {
      return record.orgName;
    },
  },
  {
    title: '到达地',
    dataIndex: 'a16',
    customRender: ({ record }) => {
      return record.dstName;
    },
  },
  {
    title: '员工部门',
    dataIndex: 'a69',
    width: 100,
    customRender({ record }) {
      return record.departmentId ? record.departmentId : '-';
    },
  },
  {
    title: '订单号',
    dataIndex: 'a70',
    width: 190,
    customRender({ record }) {
      return record.orderNum;
    },
  },
];
